window.addEventListener("load", function () {
	const apiData = [
		{ times: 4000, price: 1200, unitPrice: "0.3000" },
		{ times: 8000, price: 2000, unitPrice: "0.2500" },
		{ times: 40000, price: 8000, unitPrice: "0.2000" },
	];


	let html = "";
	apiData.forEach(function (v) {
		$(
			".fore"
		).innerHTML += `<li data-price=${v.price} data-unitPrice=${v.unitPrice}>${v.times}</li>`;
	});
	$(".fore li")[1].classList.add("active");
	$(".price-five").innerHTML = `<strong> &yen; ${
		$(".fore li")[1].dataset.price
	}</strong>(约${$(".fore li")[1].dataset.unitprice}元/次),仅限实名购买`;

	// 点击tab区增加激活样式
	// console.log($(".fore li"));
	$(".fore li").forEach(function (v, i) {
		v.addEventListener("click", function () {
			if (!this.classList.contains("default")) {
				$(".fore li").forEach(function (item) {
					item.classList.remove("active");
				});
				console.log(this);
				this.classList.add("active");
				$(
					".price-five"
				).innerHTML = `<strong> &yen; ${this.dataset.price}</strong>(约${this.dataset.unitprice}元/次),仅限实名购买`;
			}
		});
	});

//  点击跳转栏激活多赢样式,
/* 	function tab(tabSelector, tabClassName, contSelector, contClassName){
		$(tabSelector).forEach(function(v,i){
			v.addEventListener("click",function(){
				$(tabSelector).forEach(function(item,index){
					item.classList.remove(tabClassName);
					if(contSelector){
						$(contSelector)[index].classList.remove(contClassName)
					}
			});
			v.classList.add(tabClassName);
			if(contSelector){
				$(contSelector)[i].classList.add(contClassName) = "block"
			}
			})
		})

	} */
console.log($("#fore-style div"));
tab("#chooseSkip a" , "active" ,"#fore-style div","on" );
// console.log($("#fore-style div"));

	$("#btnFree").addEventListener("click",function(){
		location.href = "../html/register.html";
	/* 	$("#btnFree").style.cursor = "pointer"; */
	})




	//配置
	const config = {
		selector: "#bannerBg",
		vx: 4, //点x轴速度,正为右，负为左
		vy: 4, //点y轴速度
		height: 2, //点高宽，其实为正方形，所以不宜太大
		width: 2,
		count: 100, //点个数
		color: "#eee", //点颜色
		stroke: "0,0,0", //线条颜色
		dist: 8000, //点吸附距离
		e_dist: 20000, //鼠标吸附加速距离
		max_conn: 10, //点到点最大连接数
	};
	//调用
	CanvasParticle(config);
});
